import 'package:flutter/material.dart';
import 'package:flutter_ability/custom_ui.dart';

class AccordionPage extends StatefulWidget {
  const AccordionPage({Key? key}) : super(key: key);

  @override
  State<AccordionPage> createState() => _AccordionPageState();
}

class _AccordionPageState extends State<AccordionPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: YJAppBar(
        isScaffold: true,
        leadingType: YJAppBarType.back,
        title: TextView.text("折叠面板"),
        backgroundColor: YJColors.WHITE,
      ),
      backgroundColor: YJColors.BACKGROUND_COLOR,
      body: buildContainer(),
    );
  }

  buildContainer() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        const YJAccordion(
          title: '折叠卡片',
          content: '这是一个默认样式的折叠卡片.',
        ),
        YJAccordion(
          titleChild: TextView.text("个人资料"),
          expandedTitleBackgroundColor: YJColors.THEME_COLOR,
          contentBackgroundColor: Colors.blue[100],
          collapsedIcon: TextView.text("展开"),
          expandedIcon: TextView.text("收起"),
          contentChild: Container(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                TextView.text("这是一个默认样式的折叠卡片"),
                TextView.text("这是一个默认样式的折叠卡片"),
                TextView.text("这是一个默认样式的折叠卡片")
              ],
            ),
          ),
        ),
        YJAccordion(
          titleChild:
              TextView.text("折叠面板标题", fontSize: 16, color: YJColors.BLACK85),
          expandedTitleBackgroundColor: YJColors.WHITE,
          contentBackgroundColor: YJColors.WHITE,
          titleBorderRadius: const BorderRadius.all(Radius.circular(0)),
          contentChild: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                width: YJSize.screenWidth,
                height: 1,
                color: YJColors.LINE_COLOR,
              ),
              TextView.text(
                  "我是长段的正文文本内容，需要左侧对齐。我是长段的正文文本内容，需要左侧对齐。我是长段的正文文本内容，"
                  "需要左侧对齐。我是长段的正文文本内容，需要左侧对齐。我是长段的正文文本内容，需要左侧对齐。"
                  "我是长段的正文文本内容，需要左侧对齐。我是长段的正文文本内容，需要左侧对齐。我是长段的正文文本内容"
                  "，需要左侧对齐。我是长段的正文文本内容，需要左侧对齐。我是长段的正文文本内容，需要左侧对齐。",
                  fontSize: 14,
                  isLineHeight: false,
                  lineHeight: YJSize.dp(8),
                  color: YJColors.BLACK65),
            ],
          ),
        ),
      ],
    );
  }
}
